{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Find the k-th Largest Element in a List\n",
    "\n",
    "[The Original Question](https://mp.weixin.qq.com/s/C42D6Lku5N9Zkrb1CUX42w)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Question\n",
    "\n",
    "Given a list, find the k-th largest element in the list."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example\n",
    "\n",
    "```\n",
    "Input: list = [3, 5, 2, 4, 6, 8], k = 3\n",
    "Output: 5\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5\n"
     ]
    }
   ],
   "source": [
    "def findKthLargest(nums: list, k: int) -> int:\n",
    "    # Fill this in.\n",
    "    nums.sort()\n",
    "    return nums[-k]\n",
    "\n",
    "\n",
    "if __name__ == '__main__':\n",
    "    print(findKthLargest([3, 5, 2, 4, 6, 8], 3))\n",
    "    # 5\n",
    "    pass"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
